<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
	<title>Modifica Hotel</title>
</h:head>

<h:body>
	<h2>Modifica #{param.idh}</h2>
	#{HotelBean.setHotelById(param.idh)}
	<h:form id="edit">
		<input type="hidden" name="idh" value="#{HotelBean.hotel.id}"/>
		<p:panel header="Modifica Hotel">
			<h:panelGrid id="grid" columns="4" cellpadding="5"> 
			
			 	<h:outputLabel for="nome" value="Nome Hotel: " /> 
			 	<p:inputText id="nome" value="#{HotelBean.hotel.nome}" required="true" label="Nome"/>
			 	<p:message for="nome" />
			 	<h:outputText value="" />
			 		
			 	<h:outputLabel for="descrizione" value="Descrizione: "/>
			 	<p:inputTextarea rows="10" cols="50" id="descrizione" value="#{HotelBean.hotel.descrizione}" required="true" label="Descrizione">
					<f:validateLength minimum="5" /> 
				</p:inputTextarea>
				<p:message for="descrizione" />
				<h:outputText value="" />
				
				<h:outputLabel for="luogo" value="Località Hotel: " /> 
			 	<p:inputText id="luogo" value="#{HotelBean.hotel.luogo}" required="true" label="Luogo">
			 		<f:validateLength minimum="3" /> 
			 	</p:inputText>
			 	<p:message for="luogo" />
			 	<h:outputText value="" />
			 	
			 	<h:outputLabel for="contatti" value="Contatti: " /> 
			 	<p:inputText id="contatti" value="#{HotelBean.hotel.contatti}" required="true" label="Contatti"/>
			 	<p:message for="contatti" />
			 	<h:outputText value="" />	
			 	
			 	<h:outputLabel for="indirizzo" value="Indirizzo " /> 
			 	<p:inputText id="indirizzo" value="#{HotelBean.hotel.indirizzo}" required="true" label="Indirizzo"/>
			 	<p:message for="indirizzo" />
			 	<h:outputText value="" />	
			 	
			 	<h:outputLabel for="stelle" value="Stelle: "/>
				<p:rating id="stelle" value="#{HotelBean.hotel.stelle}" required="true" label="Stelle"/>
				<p:message for="stelle" />
				<h:outputText value="" />	
					
				<h:outputLabel for="costo" value="Costo "/>
				<p:inputText id="costo" value="#{HotelBean.hotel.costo}" required="true" label="Costo">
					<f:validateDoubleRange minimum="1" maximum="32000" />  
				</p:inputText>
				<p:message for="costo" />
				<h:outputText value="" />
				
			</h:panelGrid>
			
			<p:commandButton update="grid" icon="ui-icon-check" validateClient="true" style="margin-right:10px"
				type="submit" value="Modifica" action="#{HotelBean.modificaHotel()}"/>
                 
            <br></br>
            <br></br>
            
            <p:commandButton type="submit" id="cancelH" value="Cancella" action="#{HotelBean.cancellaHotel()}">
                 <p:confirm header="Confirmation" message="Sicuro di voler cancellare l Hotel?" icon="ui-icon-alert" />  
    		</p:commandButton>  
    		
    		<p:confirmDialog global="true" showEffect="fade" hideEffect="explode">  
        		<p:commandButton value="Si" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check"/>  
        		<p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close"/>       
    		</p:confirmDialog>  
    		
		</p:panel>
	</h:form>
</h:body>
</html>